#!/bin/sh

ACTION=`zenity --width=200 --height=280 --list --text="What now?" --title="Logout" --column "I want to..." lock_and_sleep sleep_only logout reboot shutdown`

if [ -n "${ACTION}" ];then
 case $ACTION in
 lock_and_sleep)
   slimlock& systemctl suspend
   ;;
 sleep_only)
    systemctl suspend
    ;;
 logout)
    pkill -KILL -u $(whoami)
    ;;
 reboot)
   rm /tmp/startup-sound-played && systemctl reboot
   ;;
 shutdown)
   rm /mnt/mass_storage/.spin_trigger && touch /mnt/mass_storage/.spin_trigger
   rm /tmp/startup-sound-played && systemctl poweroff
   ;;
 esac
fi
